<?php
	$css_list[0]['url'][] = './tpl/css/tweetlist.css';
	$css_list[0]['url'][] = './tpl/css/sidebar.css';
	$css_list[0]['url'][] = './tpl/css/note.css';
	$js_list[0] = './tpl/js/note.js';
?>
<!--{template inc/header}-->

<div class="divrelative">
    <div class="sharetoolsbody" id="sharetoolsbody" style="top: 84px; right: -55px; ">
        <h2>分享</h2>
        <div class="applist">
            <ul>
                <li>
        		<!--{eval $invite_title = '添加新活动，发起活动';}-->
                <!--{eval $invite_content = '添加新活动，发起活动';}-->
                <!--{eval $invite_types = array('renren','sina','tqq');}-->
                <!--{eval $invite_url = $_FANWE['site_url'].'event/list/addnew';}-->
                <!--{eval $invite_pic = '';}-->
                <!--{eval $sns_links = getSnsLink($invite_types,$invite_title,$invite_url,$invite_content,$invite_pic);}-->
                <a class="sharesina" title="分享到新浪微博"  href="{$sns_links['sina']}"></a></li>
                <li><a class="sharetx" title="分享到腾讯微博" href="{$sns_links['tqq']}"></a></li>
                <li><a class="sharerr" title="分享到人人网" href="{$sns_links['renren']}"></a>
                </li>
            </ul>
        </div>
    </div>
</div>

<div id="content" class="cf">
	<div id="maincolumn">
		<div class="utop cf">
			<div class="uhead">
				<a href="{u u/index uid=$_FANWE['uid']}"><img src="<?php echo avatar($_FANWE['uid'], 'm', $is_src = 1)?>" id="backtothis" title="{$event_detail['user_name']}" width="60" height="60"></a>
			</div>
			<div class="uright">

				<h1 class="cf" style="font-size:30px;line-height:30px;margin-top:10px;height:50px;">
                    	发起新的活动：
                </h1>
			</div>
		</div>
	
		<!--{subtemplate page/event/event_add_page}-->	
		
</div>
<style>
.join_btn{ background:#3AA28D;margin:0 auto 8px;padding:5px;text-align:center;color:#ffffff;font-size:20px;font-weight:bold;font-family:"微软雅黑"; }
.my_join_btn{ font-size:14px; }
.my_join_btn a{ padding:3px 10px;background:#EEEEEE;color:#3AA28D; }
.my_join_btn a:hover, .my_join_btn a.my_curr, .join_btn_new_curr, .join_btn_new:hover{ background:#F5588C;color:#FFFFFF; }
input[type=text],textarea, input[type=button]{-moz-border-radius: 5px; border-radius: 5px;}
input[type=text]:focus ,textarea:focus {border-color:#019DE9}
</style>
    <div id="rightcolumn">
			<!--{if $_FANWE['uid'] != 0 }-->
			<div class="join_btn join_btn_new_curr">
			<a href="{u event/list type=addnew}" style="display:inline-block;color:#FFFFFF;" id="button_let_me_join">发起新旅途</a>
			</div>
			
			<div class="join_btn my_join_btn">
			<a href="{u event/list type=mine}">我的旅途</a>
			<a href="{u event/list type=myjoin}">我参加的旅途</a>
			</div>
			<!--{/if}-->

			<div class="addfollow cf">
				<h2 class="f14 black">热门活动</h2>
				<!--{loop $event_detail['acti_list'] $act}-->
				<div class="follow_list cf side_event">
					<h3 style="color:#FFFFFF; font-size:14px;font-weight:bold;margin:0 auto 5px;padding:2px 5px;background:#3AA28D">
					<a href="{u event/detail id=$act['id']}">{$act['title']}</a></h3>
					<div style="line-height:20px;">
					<img src="{$act['pics']}" style="margin:2px 8px 2px 0;width:40px;height:40px;border:1px solid #DDDDDD;padding:1px;" align="left"/>
					<p>参加人数：<span style="font-size:18px;font-weight:bold;color:#990000;"><?php echo $act['count'] ;?></span></p>
					<p>结束：<?php echo date('Y-m-d', $act['time_end']) ;?></p>
					</div>
				</div>
				<!--{/loop}-->
			</div>

    </div>
</div>


<script type="text/javascript">
function UpdateUserFollow(obj,result)
{
	if(result.status == 1)
	{
		$(obj).before('<img class="fo_ok" src="./tpl/images/add_ok_03.png">');
		$(obj).remove();
	}
}

function show_members_info(name,tel,avatar){
	$.dialog({
		title: '参加人员信息：',lock: true,
		content: '<p><img src="'+avatar+'" /></p><p style="line-height:26px;"><label>姓名：</label><span>'+name+'</span></p><p style="line-height:26px;"><label>电话：</label><span>'+tel+'</span></p>'
	});
}
function submit_comment(id){
<!--{if $_FANWE['uid'] == 0 }-->
	$.dialog({
		title: '提示：',time:2000,
		content: '您还没有登陆！'
	});
<!--{else}-->
	var html ='<li class="c_f">';
	html += '<div class="uhead">';
	html += '<a href="{u u/album}">';
    html += '<img src="{avatar $_FANWE['uid'] s 1}" width="60" height="60">';
    html += '</a>';
    html += '</div>';
    html += '<div class="usay">';
    html += '<h3 class="cf">	';
    html += '<span class="floatright gray pd15">';
    html += '<a class="rpl blue" w="f" href="javascript:;" uname="{$_FANWE['user_name']}" cid="{$detail['id']}" onClick="$.Reply_Comment(this);">回复</a>';
    html += '</span>';
    html += '<span class="f14 blue"><a href="{u u/album}" class="blue">{$_FANWE['user_name']}</a></span>	';	
    html += '</h3><p>';
    html += $("#commentta").val();
    html += '</p><span class="gray">刚刚</span>';
    html += '</div></li>';
	$.ajax({
	   type: "POST",
	   url: "{u event/list type=ajax,order=lvtulequ}",
	   data: {id:{$event_detail['id']},content:$("#commentta").val()},
	   dataType: "json",
	   success: function(d){
			if(d.msg=="success"){
				$.dialog({
					title: '提示：',time:2000,
					content: '旅途乐趣添加成功！'
				});
				$(id).prepend(html);
			}else{ 				
				$.dialog({
					title: '提示：',time:2000,
					content: '添加失败！'
				}); 
			}
	   }
	});
<!--{/if}-->
}

function del_comment(id){
	$.dialog({
		title: '提示：',
		content: '您确定要删除吗？',
		width: 260, height: 70,
		okValue: '删除',
		ok: function(){
					$.ajax({
					   type: "POST",
					   url: "{u event/list type=ajax,order=delcomm}",
					   data: "id="+id,
					   dataType: "json",
					   success: function(d){
							if(d.msg=="success"){
								$("#COMMENT_"+id).remove();
							}
					   }
					});		
		},
		cancelValue: '取消',
		cancel: function(){}
	});
}

jQuery(function(){
	$("#fav1").bind({
		click:function(){
		
		<!--{if $_FANWE['uid'] == 0 }-->
			$.dialog({
				title: '提示：',time:2000,
				content: '您还没有登陆！'
			});
		<!--{else}-->
			$.ajax({
			   type: "POST",
			   url: "{u event/list type=ajax,order=guanzhu}",
			   data: "id={$event_detail['id']}",
			   dataType: "json",
			   success: function(d){
					if(d.msg=="success"){
						$("#fav1 .number").html( parseInt($("#fav1 .number").html())+1 );
						$.dialog({
							title: '提示：',time:2000,
							content: '关注成功！'
						});
						$("#fav1").unbind("click");
						$("#fav1").bind({
							click:function(){
								 $.dialog({
									title: '提示：',time:2000,
									content: '您已经关注过，请勿重复关注！'
								});
							}
						});
					}else if( d.msg=="notlogin" ){
						$.dialog({title: '提示：',time:2000,content: '您还没有登陆！'}); 
					}else{ 				
						$.dialog({title: '提示：',time:2000,content: '关注成功！'}); 
					}
			   }
			});
		<!--{/if}-->
		}
	});
	
	$("#fav2, #button_let_me_join").bind({
		click:function(){
			$.dialog({
				title: '提示：', 
			<!--{if $_FANWE['uid'] == 0 }-->
				content: '您还没有登陆！'
			<!--{else}-->
				lock: true,
				content: '<div id="join_in_tips" style="line-height:26px;display:none;"></div><p style="line-height:26px;"><label>姓名：</label><input type="text" style="border:1px solid #CCCCCC;margin:2px 5px;padding:2px 5px;" name="join_in_name" id="join_in_name"/></p><p style="line-height:26px;"><label>电话：</label><input type="text" style="border:1px solid #CCCCCC;margin:2px 5px;padding:2px 5px;" name="join_in_tel" id="join_in_tel"/></p>',
				okValue: '加入',
				ok: function(){
					if( $("#join_in_name").val()=="" ){
						$("#join_in_tips").html("<span style='color:#990000;'>请留下您的姓名！</span>").show();
						$("#join_in_name").focus();
						this.shake();
						return false;
					}else{ $("#join_in_tips").html(""); }
					if( $("#join_in_tel").val()=="" ){
						this.shake();
						$("#join_in_tips").html("<span style='color:#990000;'>电话号码不能为空！</span>").show();
						$("#join_in_tel").focus();
						return false;
					}else{ $("#join_in_tips").html(""); }
					$.ajax({
					   type: "POST",
					   url: "{u event/list type=ajax,order=join}",
					   data: {id:{$event_detail['id']},name:$("#join_in_name").val(),tel:$("#join_in_tel").val()},
					   dataType: "json",
					   success: function(d){
							if(d.msg=="success"){
								$.dialog({title: '提示：',time:2000,content: '加入成功！'}); 
								$("#fav2 .number").html( parseInt($("#fav2 .number").html())+1 );
							}else if( d.msg=="exist" ){
								$.dialog({title: '提示：',time:2000,content: '已经报过名了！'}); 
							}else if( d.msg=="notlogin" ){
								$.dialog({title: '提示：',time:2000,content: '您还没有登陆！'}); 
							}
					   }
					});		
				},
				cancelValue: '取消',
				cancel: function(){}
			<!--{/if}-->
			});
		}	
	});

	$("#button_invite_friends").click(function(){
		$.dialog({title: '好友分享：',content: '复制成功，您可以发送给您的好友！'}); 
	});
	
	$('#shareshow').hover(function(){
		var img_height = document.getElementById("img_height").offsetHeight;
		var half_height = img_height / 2;
		$("#flow_left").css("top",half_height).show();
		$("#flow_right").css("top",half_height).show();		
	},function(){
		$("#flow_left").hide();
		$("#flow_right").hide();
	});
	

	if ($('#commentta').val() != '' && $('#commentta').val() != '说点什么吧……') {
        $('#commentta').css({
            'height': '88px'
        });
        $('#commentta').addClass('commentta');
		$('#divconfirm').show();
        $('#divconfirm a').removeClass('unconfirm-btn').addClass('confirm-btn');
        if ($('#commentta').val().length < 141) {
            $('#divconfirm em').text($('#commentta').val().length).removeClass('overnum');
            $(this).removeClass('commenttaover')
        } else {
            $('#divconfirm em').text($('#commentta').val().length - 140).addClass('overnum');
            $('commentta').addClass('commenttaover')
        }
    }
	$('#commentta').focus(function() {
        if ($(this).val() == '说点什么吧……' || $(this).val() == '') {
            $(this).val('').addClass('commentta');
        }
        $(this).animate({
            height: "88px"
        },
        {
            queue: false,
            duration: 100
        });
        $('#divconfirm').slideDown();
        $(this).keyup(function() {
            var index = ($.trim($(this).val())).length;
            if (index > 0) {
                $('#divconfirm a').removeClass('unconfirm-btn').addClass('confirm-btn');
            } else {
                $('#divconfirm a').removeClass('confirm-btn').addClass('unconfirm-btn');
                $("#replyCommentId").val(0);
            }
            if (index < 141) {
                $('#divconfirm em').text(index).removeClass('overnum');
                $(this).removeClass('commenttaover')
            } else {
                $('#divconfirm em').text(index - 140).addClass('overnum');
                var _this = $(this);
                if (timers !== null) {
                    return;
                }
                timers = setTimeout(function() {
                    timers = null;
                    _this.addClass('commenttaover').animate({
                        opacity: '0.25'
                    },
                    50).animate({
                        opacity: '1'
                    },
                    50).animate({
                        opacity: '0.25'
                    },
                    50).animate({
                        opacity: '1'
                    },
                    50);
                },
                200);
            }
        })
    }).focusout(function() {
        if ($('#commentta').val().length == 0) {
            $("#replyCommentId").val(0);
            $(this).val('说点什么吧……').removeClass('commentta');
            $(this).animate({
                height: "52px"
            },
            {
                queue: false,
                duration: 100
            }) 
			$('#divconfirm').slideUp();
            $('#divconfirm a').removeClass('confirm-btn').addClass('unconfirm-btn');
        }
    }); 
	$('#jquery-addnumber  a em').mouseover(function() {
        $('#getnumber .minutes em').text('+' + $(this).text())
    })


	CommentInit();
});

function CommentInit()
{
	$(".pagination a").click(function(){
		var page = $(this).attr('page');
		$.Get_Share_Comment("{$event_detail['share_id']}",page,'#SHARE_COMMENT_LIST_BOX',CommentInit);
		return false;
	});
}

function copy(inElement) {
  if (inElement.createTextRange) {
    var range = inElement.createTextRange();
    if (range && BodyLoaded==1)
      range.execCommand('Copy');
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="{$_FANWE[site_root]}public/js/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}
</script>
<!--{template inc/footer}-->
